package com.fr.base.core.image4j.util;

import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;

public class ConvertUtil
{
  public static BufferedImage convert1(BufferedImage paramBufferedImage)
  {
    IndexColorModel localIndexColorModel = new IndexColorModel(1, 2, new byte[] { 0, -1 }, new byte[] { 0, -1 }, new byte[] { 0, -1 });
    BufferedImage localBufferedImage = new BufferedImage(paramBufferedImage.getWidth(), paramBufferedImage.getHeight(), 12, localIndexColorModel);
    ColorConvertOp localColorConvertOp = new ColorConvertOp(paramBufferedImage.getColorModel().getColorSpace(), localBufferedImage.getColorModel().getColorSpace(), null);
    localColorConvertOp.filter(paramBufferedImage, localBufferedImage);
    return localBufferedImage;
  }

  public static BufferedImage convert4(BufferedImage paramBufferedImage)
  {
    int[] arrayOfInt = { 0, 8388608, 32768, 8421376, 128, 8388736, 32896, 8421504, 12632256, 16711680, 65280, 16776960, 255, 16711935, 65535, 16777215 };
    return convert4(paramBufferedImage, arrayOfInt);
  }

  public static BufferedImage convert4(BufferedImage paramBufferedImage, int[] paramArrayOfInt)
  {
    IndexColorModel localIndexColorModel = new IndexColorModel(4, paramArrayOfInt.length, paramArrayOfInt, 0, false, 1, 0);
    BufferedImage localBufferedImage = new BufferedImage(paramBufferedImage.getWidth(), paramBufferedImage.getHeight(), 12, localIndexColorModel);
    ColorConvertOp localColorConvertOp = new ColorConvertOp(paramBufferedImage.getColorModel().getColorSpace(), localBufferedImage.getColorModel().getColorSpace(), null);
    localColorConvertOp.filter(paramBufferedImage, localBufferedImage);
    return localBufferedImage;
  }

  public static BufferedImage convert8(BufferedImage paramBufferedImage)
  {
    BufferedImage localBufferedImage = new BufferedImage(paramBufferedImage.getWidth(), paramBufferedImage.getHeight(), 13);
    ColorConvertOp localColorConvertOp = new ColorConvertOp(paramBufferedImage.getColorModel().getColorSpace(), localBufferedImage.getColorModel().getColorSpace(), null);
    localColorConvertOp.filter(paramBufferedImage, localBufferedImage);
    return localBufferedImage;
  }

  public static BufferedImage convert24(BufferedImage paramBufferedImage)
  {
    BufferedImage localBufferedImage = new BufferedImage(paramBufferedImage.getWidth(), paramBufferedImage.getHeight(), 1);
    ColorConvertOp localColorConvertOp = new ColorConvertOp(paramBufferedImage.getColorModel().getColorSpace(), localBufferedImage.getColorModel().getColorSpace(), null);
    localColorConvertOp.filter(paramBufferedImage, localBufferedImage);
    return localBufferedImage;
  }

  public static BufferedImage convert32(BufferedImage paramBufferedImage)
  {
    BufferedImage localBufferedImage = new BufferedImage(paramBufferedImage.getWidth(), paramBufferedImage.getHeight(), 2);
    ColorConvertOp localColorConvertOp = new ColorConvertOp(paramBufferedImage.getColorModel().getColorSpace(), localBufferedImage.getColorModel().getColorSpace(), null);
    localColorConvertOp.filter(paramBufferedImage, localBufferedImage);
    return localBufferedImage;
  }
}